#!/usr/bin/env python3

import p
import math

primes = p.getprimes(1000000)#arbitrary limit

def checkf(a,b):
    n = 0
    while True:
        ans = n**2 + (a*n) + b
        if ans not in primes:
            break
        yield ans
        n += 1

answer = 0
pair = (0,0)

for a in range(-1000,1001):
    for b in range(-1000,1001):
        x = 0
        for p in checkf(a,b):
            x += 1
        if x > answer:
            answer = x
            pair = (a,b)


print(str(pair)+":"+str(answer))
print(pair[0]*pair[1])